//
//  BMPluginController.h
//  snomPhone
//
//  Created by Daniel Hazelbaker on 4/3/09.
//  Copyright 2009 High Desert Church. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@class BMPluginController, SSCall;

#pragma mark BMPluginHandlerProtocol
@protocol BMPluginHandlerProtocol

//
// The phone address lookup continues until the first plugin returns a
// non-nil result, indicating that it found the IP address (or host name)
// we are looking for.
//
- (NSString *)lookupPhoneAddress;

//
// Phone number lookups continue until the first plugin returns a non-nil
// result, indicating that it found the phone number.
//
- (NSDictionary *)lookupPersonForPhoneNumbers:(NSArray *)phoneNumbers;

//
// Notification continues through all plugins until all plugins have been
// notified. The phoneNumber will never be nil while the person may be nil
// if no lookup found a match.
//
- (void)notifyIncomingCall:(SSCall *)call;

//
// Notification continues through all plugins until all plugins have been
// notified. The phoneNumber will never be nil while the person may be nil
// if no lookup found a match.
//
- (void)notifyOutgoingCall:(SSCall *)call;

//
// Notification that the call has ended. All handlers are notified.
//
- (void)notifyCallEnded:(SSCall *)call;

@end



#pragma mark BMPluginController
@interface BMPluginController : NSObject <BMPluginHandlerProtocol> {
    NSMutableArray	*addressHandlers, *lookupHandlers, *callHandlers;
    NSString		*phoneAddress, *phonePassword;
}

@property (nonatomic, retain) NSString *phoneAddress, *phonePassword;

- (id)initFromBundle:(NSBundle *)coreBundle;

- (void)prepareHandlers;

@end


#pragma mark Person Lookup Keys
#define kPLTitleKey				@"title"
#define kPLFirstNameKey				@"firstName"
#define kPLLastNameKey				@"lastName"
#define kPLPhoneNumberKey			@"phoneNumber"
#define kPLPhoneLabelKey			@"phoneLabel"
#define kPLAddressStreetKey			@"addressStreet"
#define kPLAddressCityKey			@"addressCity"
#define kPLAddressStateKey			@"addressState"
#define kPLAddressZIPKey			@"addressZIP"
#define kPLAddressCountryKey			@"addressCountry"
#define kPLImageData				@"imageData"
#define kPLLinkKey                  @"link"


//
// Preference panes must be no more than 497 pixels wide.
// Preference panes should be no more than 208 pixels high when possible.
//
